< previous page page_618 next page >

Page 618
Now let's create some real DELETE statements using SQL-VB. Start a new script file called SQLVB08.SQV, and enter the script commands in Listing 15.11. Save the script and execute it. Check your results against those shown in Figure 15.12.
Type.gifListing 15.11. Using the DELETE statement.
//
// sqlvb08.sqv - Testing DELETE statements
//
// create a new database
dbMake sqlvb08.mdb;
// create a table to work with
CREATE TABLE Table1
   (RecID TEXT(10),
    LastName TEXT(30),
    FirstName TEXT(30),
    RecType TEXT(5),
    Amount CURRENCY,
    LastPaid DATE
   );
// add some records to work with
INSERT INTO Table1 VALUES
   ('R01',
    'Simmons',
    'Chris',
    'LOCAL',
    '3000',
    '12/15/95'
   );
INSERT INTO Table1 VALUES
   ('R02',
    'Walters',
    'Curtis',
    'INTL',
    '5000',
    '11/30/95'
   );
INSERT INTO Table1 VALUES
   ('R03',
    'Austin',
    'Moro',
    'INTL',
    '4500',
    '01/15/96'
   );
// show loaded table
SELECT * FROM Table1 AS FirstPass;
// now delete LOCAL records
DELETE FROM Table1
   WHERE RecType = 'LOCAL';
// show results
SELECT * FROM Table1 AS SecondPass;
// eof

 
< previous page page_618 next page >

If you like this book, buy it!